$(function() {
	/*按钮激活*/
	$('.form input').each(function(){
		$(this).bind('input propertychange',function(){
			if($('.form input').eq(0).val() != '' && $('.form input').eq(1).val() != ''){
				$('button').removeClass('disabled').removeAttr('disabled')
			}else{
				$('button').addClass('disabled').attr('disabled','true')
			}
		})
	});
	/**/
	$('button').click(function(){
		$.ajax({
			type:'get',
			url:url() + '/user/setUserIdCardInfo',
			data:{
				realName:$('.form input').eq(0).val(),
				idCardNo:$('.form input').eq(1).val()
			},
			dataType:'json',
			success:function(rel,sta,xhr){
				var sessionstatus = xhr.getResponseHeader('redirectStatus');
				
				if(sessionstatus == '302'){
					window.location.href = url() + '/wxuser/goCompleteInfo';
					return false;
				};
				var rel_obj = JSON.parse(rel.result);
				//console.log(rel)
				//console.log(rel_obj)
				if(rel.code == 0 && rel_obj.status == 0){
					window.location.href = url() + '/htm/cash-password.html'
				}else{
					alert(rel_obj.message)
				}

			},
			error:function(){
				alert('error')
			}
		})
	})
			
})